package service.handle;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.opensymphony.xwork2.ActionSupport;

import util.DaoDemoUtils;
import dao.AdminDAO;
import model.Admin;

public class RetrieveUser  extends  ActionSupport{
	public String execute() {
		
		DaoDemoUtils.buildJndi();
		ApplicationContext ac = new ClassPathXmlApplicationContext("/dao/datasource-context-dao.xml");
					
		AdminDAO adminDao = (AdminDAO) ac.getBean("AdminDao");
		 
		Admin admin = adminDao.getByName(getUsername());
		setJsonModel(admin);

		return SUCCESS;
	}

	private String username;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	private Object jsonModel;

	public Object getJsonModel() {
		return jsonModel;
	}

	public void setJsonModel(Object jsonModel) {
		this.jsonModel = jsonModel;
	}

}
